package com.ttmusic.application;

import com.ttmusic.entity.User;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

public class TTApplication extends Application {

	public static int mScreenWidth;
    public static int mScreenHeight;
    private User user;
    
	@Override
	public void onCreate() {
		super.onCreate();
        mScreenWidth = getWidth(this);
        mScreenHeight = getHeight(this);
	}

	
	public static int getHeight(Context context){
        WindowManager manager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        manager.getDefaultDisplay().getMetrics(dm);
        return dm.heightPixels;
    }
    
    public static int getWidth(Context context){
        WindowManager manager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        manager.getDefaultDisplay().getMetrics(dm);
        return dm.widthPixels;
    }

    public static int getActivityHeight(Activity activity){
        return  activity.getWindow().getDecorView().getHeight();
    }

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
}
